using System;
//using System.Collections.Generic;
//using System.ComponentModel;
//using System.Data;
using System.Drawing;
//using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;

namespace UltimateDefend
{
    public partial class MainFrm : Form
    {
        static public string startup;
        bool m_bIsBack = false;
        public MainFrm()
        {
            InitializeComponent();
        }

        protected override void OnPaintBackground(PaintEventArgs e)
        {
            if (!this.m_bIsBack)
            {
                //Image i = Properties.Resources.StartScreen;
                //e.Graphics.DrawImage(i, new Rectangle(0, 0, this.Width, this.Height),
                //            new Rectangle(0, 0, i.Width, i.Height),
                //            GraphicsUnit.Pixel);
                this.m_bIsBack = true;
            }
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            Image i = Properties.Resources.StartScreen;
            e.Graphics.DrawImage(i, new Rectangle(0, 0, ClientRectangle.Width, ClientRectangle.Height),
                        new Rectangle(0, 0, i.Width, i.Height),
                        GraphicsUnit.Pixel);
            e.Graphics.Dispose();
        }
              
        private void btnExit_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btnScores_Click(object sender, EventArgs e)
        {
            HScoresFrm hScoresFrm = new HScoresFrm();
            hScoresFrm.ShowDialog();
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            //GameFrm game = new GameFrm();
            //game.ShowDialog();

            GameFrm gameFrm = new GameFrm();
            gameFrm.ShowDialog();
        }

        private void MainFrm_Load(object sender, EventArgs e)
        {
            this.Invalidate();
            startup = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);

            // Tinh toan vi tri tren man hinh thiet bi
            int x, y;
            // Dua button vao giua man hinh
            x = ClientRectangle.Width - btnStart.Width;
            x = x / 2;

            // y tinh tu duoi man hinh len
            y = ClientRectangle.Height - 40 - btnExit.Height;


            // Dat vi tri cho button
            btnStart.Left = x;
            btnScores.Left = x;
            btnExit.Left = x;

            btnExit.Top = y;
            btnScores.Top = btnExit.Top - 15 - btnScores.Height;
            btnStart.Top = btnScores.Top - 15 - btnStart.Height;
        }

       
    }
}